package com.briup.smartlab.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.briup.smartlab.bean.Labs;
import com.briup.smartlab.bean.Log;
import com.briup.smartlab.service.ILogService;
import com.briup.smartlab.util.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 系统日志 前端控制器
 * </p>
 *
 * @author briup
 * @since 2023-07-19
 */
@Api(tags = "日志信息管理")
@RestController
@RequestMapping("/syslog")
public class LogController {
    @Autowired //从ioc容器获取service层对象
    private ILogService service;

    @ApiOperation("分页多条件查询日志信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页面",required = true),
            @ApiImplicitParam(name = "pageSize",value = "每页大小",required = true),
            @ApiImplicitParam(name = "key",value = "用户名"),
            @ApiImplicitParam(name = "start",value = "开始日期"),
            @ApiImplicitParam(name = "end",value = "结束日期")
    })
    @GetMapping("/page")
    public Response findByPage(Integer pageNum,Integer pageSize,String key,String start,String end){
        //1.请求报文接收参数(自动)
        //2.调用service方法,接收到分页数据
        Page<Log> page = service.findByPage(pageNum, pageSize, key, start, end);
        //3.将分页信息返回到响应报文
        return Response.success(page);
    }
}
